﻿//////////////////////////////////////////////////////////////////////////////
//
//  Copyright © 1998-2024 Glodon Company Limited.  All rights reserved.
//
//  Use of this software is subject to the terms of the Glodon license
//  agreement provided at the time of installation or download, or which
//  otherwise accompanies this software in either electronic or hard copy form.  
//
//////////////////////////////////////////////////////////////////////////////


#pragma once
#include "GnufValueInput.h"
#include "GnufCheckControl.h"

namespace gnuf{
    class Info;

    class GNUF_BASE_EXPORT BoolValueInput
        : public ValueInput<bool>
        , public ICheckControlHandler
    {
        DEFINE_CAST_DERIVED(gnuf::BoolValueInput, gnuf::ValueInputBase)
    public:
        explicit BoolValueInput(std::uint16_t, bool, gcmp::OwnerPtr< Info > &);
        virtual ~BoolValueInput();

        inline const CheckControl * checkControl() const { return m_checkCtrl.get(); }
        inline       CheckControl * checkControl()       { return m_checkCtrl.get(); }
    
    protected:
        // Inherits from ValueInput...
        virtual void onPostValueChanged() override;
        // Inherits from ICheckControlHandler...
        virtual void onCheckStateChanged(bool) override;
        virtual void onPostAbilityChanged() override;

    private:
        gcmp::OwnerPtr< CheckControl > m_checkCtrl;
    };

}
